package com.danskin.wechat.webapi;

import javax.servlet.http.HttpServletRequest;

import org.jeewx.api.core.exception.WexinReqException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.danskin.wechat.model.AccessResponse;

/**
 * 第三方平台对外开放接口
 * 
 * @author Allen Liu
 *
 */
@RestController
@RequestMapping("api/wechat/open")
public class WechatOpenController extends BaseApiController {

	/**
	 * 获取AccessToken
	 * 
	 * @throws WexinReqException
	 */
	@RequestMapping(value = "getAccessToken", method = RequestMethod.GET)
	public AccessResponse<String> getAccessToken(HttpServletRequest request) throws WexinReqException {
		String accessToken = getComponentAccessToken();
		return new AccessResponse<String>("0", "ok", accessToken);
	}
}
